<!DOCTYPE html>
<html>
<head>
    {include file='public/meta'/}
    <link rel="stylesheet" href="__STATIC_URL__/static/css/bootstrapSwitch.css">

    <link rel="stylesheet" href="__STATIC_URL__/static/css/setcard.css"/>
    <link rel="stylesheet" type="text/css" href="__STATIC_URL__/static/css/bootstrap-datetimepicker.css"/>

    <script src="__STATIC_URL__/static/js/bootstrap-datetimepicker.js" type="text/javascript" charset="utf-8"></script>
    <script src="__STATIC_URL__/static/js/setcard.js" type="text/javascript" charset="utf-8"></script>
    <script src="__STATIC_URL__/static/js/creatcard.js?v=5"></script>
</head>
<body id="body">
{include file='public/header'/}
<!------------------导航-------------------------->
<section>
    {include file='public/left'/}
    <!--------------------------主要内容区域------------------------------------->
    <div class="content">
        <!--路径导航-->
        <ol class="breadcrumb">
            <li>当前位置是&nbsp;:</li>
            <li>
                <a href="{:url('cardus/cardinfo',['card_id'=>$card['card_id']])}">会员卡</a>
            </li>
            <li class="active" style="color: #02b87f;">会员卡设置</li>
        </ol>
        <!--创建会员卡主要内容-->
        <div class="card-content clearfix">
            <div class="pull-left card-left">
                <div class="cardL-body">
                    <div class="cardL-title"
                         style="background: #000 url(__STATIC_URL__/static/images/APPtop.png) no-repeat center top;"></div>
                    <div style="padding: 15px;">
                        {notempty name="card.pic_url"}
                        <div class="card" style="background-image: url({$card.pic_url});background-position: left top;background-repeat: repeat;background-size: cover;">
                            {else/}
                            <div class="card" style="background-image: url(__STATIC_URL__/static/mobile/images/card_b.png);background-color: {$card['color']};background-position: left top;background-repeat: repeat;background-size: cover;">
                                {/notempty}
                                <div class="cardL-top">
                                    <div class="cardL-logo-wrap pull-left">
                                        <div style="background-size: cover;background-image:url({$card.logo_url});background-position:left top;" class="cardL-logo logopic"></div>
                                    </div>
                                    <div class="pull-left">
                                        <div class="cardL-name brand_name">{$card['base_info']['brand_name']}</div>
                                        <div class="cardL-name brand_title">{$card['base_info']['title']}</div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="cardL-type">
                        <div class="card_custom_field left-jifen">
                            <span class="r-title">积分</span>
                            <span class="r-describe" style="color: rgb(53, 164, 222);">0</span>
                        </div>
                        <div class="card_custom_field left-yue">
                            <span class="r-title">余额</span>
                            <span class="r-describe" style="color: rgb(53, 164, 222);">0</span>
                        </div>

                        <div class="card_custom_field left-tabs self-type type  {if condition='$card.is_field3 neq 1'}hide{/if}" onclick="tabsigleshow('profile','type')"id="rank">
                            <span class="r-title  hui title" id="left-type-bt">{$card['custom_field3']['name']}</span>
                            <span class="r-describe vice typetext" id="left-type-fbt" style="color: rgb(53, 164, 222);">查看</span>
                        </div>

                    </div>
                    {if condition="$card['is_center'] eq '1'"}
                    <div class="quick_pay show ng-scope member-card-editable-container  left-tabs" id="pay-weixin">
                        <a href="javascript:;" class="r-btn ng-binding centerbt centerbt-bt"
                           style="color: rgb(53, 164, 222); border-color: rgb(53, 164, 222);">

                            {if condition="$card['base_info']['center_title'] eq ''"}
                            微信支付
                            {else/}
                            {$card['base_info']['center_title']}

                            {/if}


                        </a>
                        <div style="font-size: 12px;margin-top: 4px;color:#3c3c3c;"
                             class="centerfbt ng-binding ng-scope  center-title centerfbt-bt">

                        </div>
                    </div>
                    {/if}
                    <div class="r-cell s-first" id="card-self-tab">
                        <ul>
                            <li class="member-card-editable-container left-tabs recharge" onclick="tabsigleshow('settings','recharge')">
                            <span class="ng-binding self-0-bt cell1-bt cell1">
                                {if condition="$card['is_cell1'] neq '1'"}自定义入口
                                {else/}
                                {if condition="$card['custom_cell1']['name'] eq ''"}
                                自定义入口
                                {else/}
                                {$card['custom_cell1']['name']}
                                {/if}
                                {/if}

                            </span>
                                <span class="r-tip  self-0-lfbt tit1-bt tit1">
                                {if condition="$card['is_cell1'] neq '1'"}未使用
                                {else/}
                                {if condition="$card['custom_cell1']['tips'] eq ''"}
                                未使用
                                {else/}
                                {$card['custom_cell1']['tips']}
                                {/if}
                                {/if}

                            </span>
                            </li>
                            <li class="member-card-editable-container left-tabs integral"
                                onclick="tabsigleshow('settings','integral')">
                            <span class="ng-binding self-1-bt cell2-bt cell2">
                                {if condition="$card['is_cell2'] neq '1'"}自定义入口1
                                {else/}
                                    {if condition="$card['custom_cell2']['name'] eq ''"}
                                    自定义入口1
                                    {else/}
                                        {$card['custom_cell2']['name']}
                                    {/if}
                                {/if}
                            </span>
                                <span class="r-tip  self-1-lfbt tit2-bt tit2">
                                {if condition="$card['is_cell2'] neq '1'"}未使用
                                {else/}
                                {if condition="$card['custom_cell2']['tips'] eq ''"}
                                未使用
                                {else/}
                                {$card['custom_cell2']['tips']}
                                {/if}
                                {/if}
                            </span>
                            </li>

                            <li class="member-card-editable-container left-tabs marketing"
                                onclick="tabsigleshow('settings','marketing')">
                            <span class="ng-binding self-2-bt cell3-bt cell3">
                                {if condition="$card['is_cell3'] neq '1'"}自定义入口2
                                {else/}
                                    {if condition="$card['custom_cell3']['name'] eq ''"}
                                    自定义入口2
                                    {else/}
                                        {$card['custom_cell3']['name']}
                                    {/if}
                                {/if}
                            </span>
                                <span class="r-tip  self-2-lfbt tit3-bt tit3">
                                {if condition="$card['is_cell3'] neq '1'"}未使用
                                {else/}
                                {if condition="$card['custom_cell3']['tips'] eq ''"}
                                未使用
                                {else/}
                                {$card['custom_cell3']['tips']}
                                {/if}
                                {/if}
                            </span>
                            </li>
                            <li class="member-card-editable-container left-tabs recommend"
                                onclick="tabsigleshow('settings','recommend')">
                            <span class="ng-binding self-3-bt cell4-bt cell4">
                                {if condition="$card['is_cell4'] neq '1'"}自定义入口3
                                {else/}
                                    {if condition="$card['custom_cell4']['name'] eq ''"}
                                    自定义入口3
                                    {else/}
                                        {$card['custom_cell4']['name']}
                                    {/if}
                                {/if}
                            </span>
                                <span class="r-tip  self-3-lfbt tit4-bt tit4">
                                {if condition="$card['is_cell4'] neq '1'"}未使用
                                {else/}
                                {if condition="$card['custom_cell4']['tips'] eq ''"}
                                未使用
                                {else/}
                                {$card['custom_cell4']['tips']}
                                {/if}
                                {/if}
                            </span>
                            </li>
                            <li class="member-card-editable-container memberDetail carddetail left-tabs" onclick="tabsigleshow('carddetail','memberDetail')">
                                <span>会员卡详情</span>
                            </li>
                            <li class="member-card-editable-container applyMall carddetail left-tabs" onclick="tabsigleshow('carddetail','applyMall')"><span>适用门店</span></li>
                            <li><span>公众号</span></li>
                        </ul>
                    </div>
                </div>
                <div class="cardR-right">
                    <div style="width: 100%;">
                        <!-- TAB导航 -->
                        <ul class="nav nav-tabs" role="tablist" id="myTabs">
                            <li role="presentation" class="active">
                                <a href="#home" aria-controls="home" role="tab" data-toggle="tab">基本信息</a>
                            </li>
                            <li role="presentation">
                                <a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">自定义会员信息类目</a>
                            </li>
                            <li role="presentation">
                                <a href="#messages" aria-controls="messages" role="tab" data-toggle="tab">中心按钮</a>
                            </li>
                            <li role="presentation">
                                <a href="#settings" aria-controls="settings" role="tab" data-toggle="tab">自定义/营销入口</a>
                            </li>
                            <li role="presentation">
                                <a href="#carddetail" aria-controls="carddetail" role="tab" data-toggle="tab">会员卡详情</a>
                            </li>
                        </ul>
                        <!-- Tab 内容 -->
                        <div class="panel panel-default" style="margin-top: 15px;">
                            <form class="form-horizontal" action="" method="post" id="creatcards">
                                <div class="tab-content">
                                    <!--基本信息-->
                                    <div role="tabpanel" class="tab-pane active" id="home">
                                        <div class="panel-heading">基本信息</div>
                                        <div class="panel-body">
                                            <div class="form-group">
                                                <label class="col-sm-2 control-label">卡券封面：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                <div class="col-sm-10">
                                                    <select class="form-control" id="cover">
                                                        <option value="1" {if condition="$card['pic_url'] neq ''"}selected{/if}>图片</option>
                                                        <option value="2" {if condition="$card['pic_url'] eq ''"}selected{/if}>颜色</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="form-group" >
                                                <label class="col-sm-2 control-label"></label>
                                                <div class="col-sm-10">
                                                    <div class="cover hide" id="urls">
                                                        <div class="r-desc ng-scope">请参照
                                                            <a style="color: #2db7f5;display: inline-block;font-size: 14px;" href="https://mp.weixin.qq.com/cgi-bin/readtemplate?t=cardticket/card_cover_tmpl&amp;type=info&amp;lang=zh_CN" title="" target="_blank">图片规范</a> 上传  建议1000*600像素 格式为.jpg
                                                        </div>
                                                        <div class="ng-scope" style="position: relative;">
                                                            <span class="btn btn-default">上传会员卡图片</span>
                                                            <input type="file" id="card" value="" onchange="upload('card', 'file')"/>
                                                            <input type="hidden" id="card-pic" name="bg_url_abs" value="{$card['bg_url_abs']}">
                                                            <input type="hidden" name="background_pic_url" id="card-upload" value="{$card.pic_url}">
                                                        </div>
                                                    </div>
                                                    <div class="cover hide" id="colors">
                                                        <input type="hidden" name="base[color]" value="{$card['color']}" id="card_color">
                                                        <ul class="color-list clearfix">
                                                            <li {if condition="$card['color'] eq '#63b359'"} class="selected" {/if} style="background-color:#63b359;" data-color="#63b359"></li>
                                                            <li {if condition="$card['color'] eq '#2c9f67'"} class="selected" {/if} style="background-color:#2c9f67;" data-color="#2c9f67"></li>
                                                            <li {if condition="$card['color'] eq '#509fc9'"} class="selected" {/if} style="background-color:#509fc9;" data-color="#509fc9"></li>
                                                            <li {if condition="$card['color'] eq '#5885cf'"} class="selected" {/if} style="background-color:#5885cf;" data-color="#5885cf"></li>
                                                            <li {if condition="$card['color'] eq '#9062c0'"} class="selected" {/if} style="background-color:#9062c0;" data-color="#9062c0"></li>
                                                            <li {if condition="$card['color'] eq '#d09a45'"} class="selected" {/if} style="background-color:#d09a45;" data-color="#d09a45"></li>
                                                            <li {if condition="$card['color'] eq '#e4b138'"} class="selected" {/if} style="background-color:#e4b138;" data-color="#e4b138"></li>
                                                            <li {if condition="$card['color'] eq '#ee903c'"} class="selected" {/if} style="background-color:#ee903c;" data-color="#ee903c"></li>
                                                            <li {if condition="$card['color'] eq '#f08500'"} class="selected" {/if} style="background-color:#f08500;" data-color="#f08500"></li>
                                                            <li {if condition="$card['color'] eq '#a9d92d'"} class="selected" {/if} style="background-color:#a9d92d;" data-color="#a9d92d"></li>
                                                            <li {if condition="$card['color'] eq '#dd6549'"} class="selected" {/if} style="background-color:#dd6549;" data-color="#dd6549"></li>
                                                            <li {if condition="$card['color'] eq '#cc463d'"} class="selected" {/if} style="background-color:#cc463d;" data-color="#cc463d"></li>
                                                            <li {if condition="$card['color'] eq '#cf3e36'"} class="selected" {/if} style="background-color:#cf3e36;" data-color="#cf3e36"></li>
                                                            <li {if condition="$card['color'] eq '#5E6671'"} class="selected" {/if} style="background-color:#5E6671" data-color="#5E6671"></li>
                                                        </ul>
                                                    </div>
                                                </div>
                                            </div>
                                            <!--<div class="form-group">-->
                                            <!--<label class="col-sm-2 control-label">商户名称：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>-->
                                            <!--<div class="col-sm-10">-->
                                            <!--<input type="hidden" name="card_id" value="{$card.card_id}">-->
                                            <!--<input type="hidden" name="mid" value="{$card.mid}">-->
                                            <!--<input type="text" maxlength="12" name="base[brand_name]" readonly="readonly" id="brand_name" value="{$card.brand_name}" class="form-control" oninput="binding('brand_name')" />-->
                                            <!--<div class="r-desc ng-binding ng-scope">建议会员卡标题包含商户名或服务内容，如**会员尊享卡,字数上限为12个字符。</div>-->
                                            <!--</div>-->
                                            <!--</div>-->
                                         
                                            <div class="form-group">
                                                <label class="col-sm-2 control-label">会员卡标题：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                <div class="col-sm-10">
                                                    <input type="text" name="base[title]"  readonly class="form-control" value="{$card['base_info']['title']}" id="brand_title" oninput="binding('brand_title')" />
                                                    <div class="r-desc ng-binding ng-scope">建议会员卡标题包含商户名或服务内容，如**会员尊享卡,字数上限为9个字符。</div>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-2 control-label">LOGO：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                <div class="col-sm-10">
                                                    <div class="ng-scope" style="position: relative;">
                                                        <span class="btn btn-default">上传</span>
                                                        <input type="file" id="logopic" value="" onchange="upload('logopic', 'file')"/>
                                                        <input type="hidden" id="logopic-pic"  value="{$card['logo_url_abs']}" name="logo_url_abs">
                                                        <input type="hidden" name="base[logo_url]" id="logopic-upload" value="{$card.logo_url}" >
                                                    </div>
                                                    <div class="r-desc ng-binding ng-scope">建议300*300像素 格式为.jpg</div>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-2 control-label ng-binding">code展示类型：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                <div class="col-sm-10">
                                                    <select name="base[code_type]" class="selectpicker form-control ng-valid ng-scope ng-not-empty ng-dirty ng-valid-parse ng-touched">
                                                        <option label="文本" {if condition="$card['base_info']['code_type'] eq 'CODE_TYPE_TEXT'"} selected{/if} value="CODE_TYPE_TEXT">文本</option>
                                                        <option label="一维码" value="CODE_TYPE_BARCODE" {if condition="$card['base_info']['code_type'] eq 'CODE_TYPE_BARCODE'"} selected{/if}>一维码</option>
                                                        <option label="二维码" value="CODE_TYPE_QRCODE" {if condition="$card['base_info']['code_type'] eq 'CODE_TYPE_QRCODE'"} selected{/if}>
                                                        二维码
                                                        </option>
                                                        <option label="仅显示二维码" value="CODE_TYPE_ONLY_QRCODE" {if condition="$card['base_info']['code_type'] eq 'CODE_TYPE_ONLY_QRCODE'"} selected{/if}>仅显示二维码</option>
                                                        <option label="仅显示一维码" value="CODE_TYPE_ONLY_BARCODE" {if condition="$card['base_info']['code_type'] eq 'CODE_TYPE_ONLY_BARCODE'"} selected{/if}>仅显示一维码
                                                        </option>
                                                        <option label="不显示任何码型" value="CODE_TYPE_NONE" {if condition="$card['base_info']['code_type'] eq 'CODE_TYPE_NONE'"} selected{/if}>不显示任何码型</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-2 control-label">每人可领取：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                <div class="col-sm-10">
                                                    <input type="text" name="base[get_limit]" id="get_limit" value="{$card['base_info']['get_limit']}" class="form-control" />
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-2 control-label">创建库存数量：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                <div class="col-sm-10">

                                                    <input type="text" name="base[sku][quantity]" readonly="readonly" id="kucun" value="{$card['base_info']['sku']['quantity']}" class="form-control" />
                                                    <input type="hidden" name="activate" value="0">
                                                </div>
                                            </div>
                                            <!--<div class="form-group">-->
                                            <!--<label class="col-sm-2 control-label ng-binding">激活方式：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>-->
                                            <!--<div class="col-sm-10">-->
                                            <!--<span class="radio pull-left" style="margin-right: 15px;">-->
                                            <!--<input name="activate" disabled="disabled" {if condition="$card['activate'] eq '1'"}checked{/if} type="radio" style="margin-left: 0;">-->
                                            <!--<label class="ng-binding">自动</label>-->
                                            <!--</span>-->
                                            <!--<span class="radio pull-left">-->
                                            <!--<input name="activate" disabled="disabled"  {if condition="$card['activate'] eq '0'"}checked{/if} type="radio" style="margin-left: 0;">-->
                                            <!--<label class="ng-binding">填写信息后激活</label>-->
                                            <!--</span>-->
                                            <!--</div>-->
                                            <!--</div>-->
                                            <div class="form-group">
                                                <label class="col-sm-2 control-label">有效期：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                <div class="col-sm-10">
                                                    <label class="control-label ng-scope">永久有效</label>
                                                    <input type="hidden" name="base[date_info][type]"
                                                           value="DATE_TYPE_PERMANENT">
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-2 control-label ng-binding">可用时段：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                <div class="col-sm-10">
													<span class="radio">
														<input name="time_limit" type="radio" checked="checked"
                                                               style="margin-left: 0;">
														<label class="ng-binding">全部时段</label>
													</span>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <label class="col-sm-2 control-label ng-binding">折扣优惠：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                                <div class="col-sm-10">
													<span class="radio pull-left" style="margin-right: 15px;">
														<input name="is_discount" value="1" type="radio" {if condition="$card['is_discount'] neq '0'"}checked{/if} style="margin-left: 0;">
														<label class="ng-binding">启用</label>
													</span>
                                                    <span class="radio pull-left">
														<input name="is_discount" value="0"  type="radio" {if condition="$card['is_discount'] eq '0'"}checked{/if} style="margin-left: 0;">
														<label class="ng-binding">不启用</label>
													</span>
                                                </div>
                                            </div>
                                            <div class="form-group {if condition="$card['discount'] eq '0'"} hide {/if}" id="discount">
                                            <label class="col-sm-2 control-label">折扣：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <input type="text" name="discount" value="{$card['discount']}" class="form-control"  id="discountVal"/>
                                                <div class="r-desc ng-binding ng-scope">请填写1-99之间的数字，88即8.8折</div>
                                            </div>
                                        </div>

                                        <div class="form-group">
                                            <label class="col-sm-2 control-label ng-binding">积分优惠：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <span class="radio pull-left" style="margin-right: 15px;">
                                                    <input name="supply_bonus" value="1" {if condition="$card['supply_bonus'] eq '1'"}checked{/if} type="radio" style="margin-left: 0;">
                                                    <label class="ng-binding">启用</label>
                                                </span>
                                                {if condition="$card['supply_bonus'] neq '1'"}
                                                <span class="radio pull-left">
														<input name="supply_bonus" value="2" type="radio"  {if condition="$card['supply_bonus'] neq '1'"}checked{/if} style="margin-left: 0;">
														<label class="ng-binding">不启用</label>
													</span>
                                                {/if}
                                            </div>
                                        </div>

                                        <div id="is_bonus"  {if condition="$card['supply_bonus'] neq '1'"} class="hide" {/if}>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">初始积分：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <input type="text" name="bonus[init_increase_bonus]" id="csjf" value="{$card['bonus_rule']['init_increase_bonus']}" class="form-control"/>
                                            </div>
                                        </div>
                                        <div class="form-group"><label class="col-sm-2 control-label">消费送积分：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <div class="form-inline">
                                                    每消费
                                                    <input name="bonus[cost_money_unit]" id="permoney" value="{$card['bonus_rule']['cost_money_unit']}" class="form-control">
                                                    元,赠送
                                                    <input name="bonus[increase_bonus]" id="zsjf" value="{$card['bonus_rule']['increase_bonus']}" class="form-control">
                                                    积分
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group">
                                            <label class="col-sm-2 control-label">单次上限：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <input type="text" name="bonus[max_increase_bonus]" id="single" value="{$card['bonus_rule']['max_increase_bonus']}" class="form-control"/>
                                                <div class="r-desc ng-binding ng-scope">请设置单次增加积分的上限，不填写表示无限制</div>
                                            </div>
                                        </div>
                                        <div class="form-group"><label class="col-sm-2 control-label">积分抵扣：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <div class="form-inline">
                                                    每使用
                                                    <input name="bonus[cost_bonus_unit]" id="sydk" value="{$card['bonus_rule']['cost_bonus_unit']}" class="form-control">
                                                    积分,抵扣
                                                    <input name="bonus[reduce_money]" id="dkmoney" value="{$card['bonus_rule']['reduce_money']}" class="form-control">
                                                    元
                                                </div>
                                            </div>
                                        </div>
                                        <div class="form-group"><label class="col-sm-2 control-label">抵扣条件：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                            <div class="col-sm-10">
                                                <div class="form-inline">
                                                    订单满
                                                    <input name="bonus[least_money_to_use_bonus]" id="ordermoney" value="{$card['bonus_rule']['least_money_to_use_bonus']}" class="form-control">
                                                    元可用，单笔上限
                                                    <input name="bonus[max_reduce_bonus]" id="ordersx" value="{$card['bonus_rule']['max_reduce_bonus']}" class="form-control">
                                                    积分
                                                </div>
                                            </div>
                                        </div>
                                    </div>

                                </div>
                        </div>
                        <div role="tabpanel" class="tab-pane" id="profile" style="margin: 15px;">
                            <div class="panel-body">
                                <div class="alert hide alert-danger ng-scope">该会员卡已开通储值卡，自定义会员信息类目一不再生效！</div>
                                <div class="form-group hide">
                                    <label class="col-sm-2 control-label ng-binding">余额开关：</label>
                                    <div class="col-sm-10">
													<span class="radio pull-left" style="margin-right: 15px;">
														<input name="supply_balance" value="1" {if condition="$card.supply_balance eq '1'"}disabled="disabled" checked{/if} type="radio"  style="margin-left: 0;">
														<label class="ng-binding">启用</label>
													</span>
                                        <span class="radio pull-left">
														<input name="supply_balance" value="2"{if condition="$card.supply_balance eq '1'"}disabled="disabled"{/if}  {if condition="$card.supply_balance eq '2'"}checked{/if} type="radio" style="margin-left: 0;">
														<label class="ng-binding">不启用</label>
													</span>
                                    </div>
                                </div>
                                <div class="panel hide panel-default level-2" style="display: none;">
                                    <div class="panel-heading">自定义会员信息类目0
                                        <div class="pull-right">
                                            <input type="hidden" value="1" name="is_field2" >
                                        </div>
                                    </div>
                                    <div class="panel-body" style="padding:30px;">
                                        <div class="form-group">
                                            <label class="font400">标题(选填)：</label>
                                            <input type="text" class="form-control" name="custom_field2[name]" value="余额" placeholder="请输入标题(选填)" readonly>
                                        </div>
                                        <div class="form-group">
                                            <label class="font400">链接：</label>
                                            <input type="text" name="custom_field2[url]" class="form-control" value="{$url['platurl']}/mobile.php/carduser/balance" readonly>
                                        </div>
                                    </div>
                                </div>
                                <div class="panel panel-default level-2" id="type">
                                    <div class="panel-heading">自定义会员信息类目1
                                        <div class="pull-right">
                                            <input type="hidden" value="{$card['is_field3']}" name="is_field3" class="top-type-2" id="is_field3">
                                            <a class="btn-link2 ng-scope" data-type="2" href="javascript:;">{if condition="$card.is_field3 eq '1'"}已开启{else}已关闭{/if}</a>
                                        </div>
                                    </div>

                                    <div class="panel-body" style="padding:30px;">
                                        <div class="form-group">
                                            <label class="font400">类型：</label>

                                            <select name="custom_field3[name]" id="self-type-ch" class="form-control" {if condition="$card.is_field3 neq '1'"}disabled{/if} onchange="selfselect(this.id)">
                                            {if condition="$card['custom_field3']['name'] neq ''"}<option value="{$card['custom_field3']['name']}" selected>{$card['custom_field3']['name']}</option>{/if}
                                            {volist name="urllists" id="vo1"}
                                            <option  {if condition="$card['custom_field3']['name'] eq $vo1.name "}selected{/if} value="{$vo1.name}" data-bt="{$vo1.name}" data-fbt="{$vo1.sub_name}" data-url="{$url['platurl']}{$vo1.url}">{$vo1.name}</option>
                                            {/volist}
                                            </select>
                                            <input type="hidden" value="{$card['custom_field3']['name']}" class="form-control"  placeholder="请输入标题" id="title" style="margin-top: 10px;" name="custom_field3[name]" oninput="showhui(this);" onchange="tex('title','btext','5');">
                                            <div class="help-block" id="btext"></div>
                                        </div>
                                        <div class="form-group">
                                            <label class="font400">副标题(选填)：</label>
                                            <input type="text"  value="" class="form-control" placeholder="请输入标题(选填)" readonly="readonly" id="typetext" oninput="showvice(this);" onchange="tex('typetext','typtext','5');">
                                            <div class="help-block" id="typtext"></div>
                                        </div>
                                        <div class="form-group">
                                            <label class="font400">链接：</label>
                                            <input name="custom_field3[url]"  class="form-control"  id="type-url" value="{$card['custom_field3']['url']}"  placeholder="">
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div role="tabpanel" class="tab-pane" id="messages">
                            <div class="panel-body">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label ng-binding">按钮</label>
                                    <div class="col-sm-10">
													<span class="radio pull-left" style="margin-right: 15px;">
														<input name="base[is_center]" {if condition="$card['is_center'] neq '2'"}checked{/if} value="1" type="radio" style="margin-left: 0;">
														<label class="ng-binding">显示</label>
													</span>
                                        <span class="radio pull-left">
														<input name="base[is_center]" type="radio" value="2" style="margin-left: 0;" {if condition="$card['is_center'] eq '2'"}checked{/if}>
														<label class="ng-binding">不显示</label>
													</span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label ng-binding">按钮类型：</label>
                                    <div class="col-sm-10">
                                        <select name="base[center]" class="form-control" id="swithtype" onchange="selecttype(this.id)" {if condition="$card['is_center'] eq '2'"}disabled{/if}>
                                        {if condition="$card['base_info']['center_title'] eq ''"}
                                        <option value="9" selected>微信支付</option>
                                        {else/}
                                        <option  value="{$card['base_info']['center_title']}" selected>{$card['base_info']['center_title']}</option>


                                        {/if}

                                        <option value="9">微信支付</option>
                                        {volist name="urllist" id="vo"}
                                        <option value="{$vo.name}" data-url="{$url['platurl']}{$vo.url}" {if condition="$card['base_info']['center_title'] eq $vo.name"}selected{/if}>{$vo.name}</option>
                                        {/volist}
                                        </select>
                                        <input type="hidden" value="" class="form-control"  placeholder="请输入标题" id="centerbt-bt" style="margin-top: 10px;" name="base[center]" oninput="showtitl('centerbt',this);" onchange="tex('centerbt-bt','centext','5');" >
                                        <div class="help-block" id="centext"></div>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label ng-binding">标题：</label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control swithtype swithtype-bt centerbt-bt" readonly="readonly" name="base[center_title]" id="centerbt" value="{$card['base_info']['center_title']}" placeholder=""/>
                                    </div>
                                </div>
                                <div class="form-group" id="sub" {if condition="$card['base_info']['center_title'] eq '微信支付'"} style="display:none" {/if}>
                                <label class="col-sm-2 control-label ng-binding">副标题：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control swithtype swithtype-fbt" name="base[center_sub_title]" id="centerfbt" value="" placeholder="" oninput="showtitl('centerfbt',this);" onchange="text('centerfbt','','16');" />
                                    <div class="r-desc ng-binding ng-scope">字段长度限制为16个字符，中文2个字符，数字，字母1个字符。</div>

                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-sm-2 control-label ng-binding">链接：</label>
                                <div class="col-sm-10">
                                    <input type="text" class="form-control swithtype swithtype-url" readonly="readonly" name="base[center_url]" id="center_url" value="{$card['base_info']['center_url']}" placeholder=""/>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div role="tabpanel" class="tab-pane" id="settings">
                        <div class="panel-body">
                            <div class="panel panel-default" id="recharge">
                                <div class="panel-heading">自定义入口
                                    <div class="pull-right">
                                        <input type="hidden" name="is_cell1" id="self-ipt-0" value="{$card.is_cell1}">
                                        <a class="btn-link ng-scope" href="javascript:;" data-type="0" data-name="自定义入口">{if condition="$card['is_cell1'] eq '1'"}已开启{else}已关闭{/if}</a>
                                    </div>
                                </div>

                                <div class="panel-body" style="padding:30px;">
                                    <div class="form-group">
                                        <label class="font400">标题：</label>
                                        <select name="custom_cell1[name]" {if condition="$card['is_cell1'] neq '1'"}disabled{/if} class="form-control" id="self-0" onchange="selectchange(this.id)">
                                        {if condition="$card['custom_cell1']['name'] neq ''"}<option value="" selected> {$card['custom_cell1']['name']}</option>{/if}
                                        <option value="">--请选择--</option>
                                        {volist name="urllist" id="dict"}
                                        <option value="{$dict.name}" data-title="{$dict.sub_name}" data-url="{$url['platurl']}{$dict.url}" {if condition="$card['custom_cell1']['name'] eq $dict.name"}selected{/if}>{$dict.name}</option>
                                        {/volist}
                                        </select>
                                        <div class="r-desc ng-binding ng-scope">字段长度限制为5，请填写1-5个汉字</div>
                                        <input type="hidden" value="{$card['custom_cell1']['name']}" class="form-control" placeholder="请输入标题" id="cell1" style="margin-top: 10px;"
                                               name="custom_cell1[name]"  oninput="showinput(this.id,this);"  onchange="tex('cell1','cell1text','5');">
                                        <div class="help-block" id="cell1text"></div>
                                    </div>
                                    <div class="form-group">
                                        <label class="font400">副标题：</label>
                                        <input type="text" name="custom_cell1[tips]" value="{$card['custom_cell1']['tips']}"  class="form-control self-0-fbt" id="tit1" placeholder="请输入副标题" oninput="showtitl(this.id,this);" onchange="text('tit1','tit1text','12');">
                                        <div class="help-block" id="tit1text"></div>
                                        <div class="r-desc ng-binding ng-scope">字段长度限制为12个字符，中文2个字符，数字，字母1个字符。</div>
                                    </div>
                                    <div class="form-group">
                                        <label class="font400">链接：</label>
                                        <input type="text" name="custom_cell1[url]" value="{$card['custom_cell1']['url']}"  class="form-control self-0-url" placeholder="" >
                                    </div>
                                </div>
                            </div>
                            <div class="panel panel-default" id="integral">
                                <div class="panel-heading">自定义入口1
                                    <div class="pull-right">
                                        <input type="hidden" name="is_cell2" id="self-ipt-1" value="{$card['is_cell2']}">
                                        <a class="btn-link ng-scope" href="javascript:;" data-type="1" data-name="自定义入口1">{if condition="$card['is_cell2'] eq '1'"}已开启{else}已关闭{/if}</a>
                                    </div>
                                </div>
                                <div class="panel-body" style="padding:30px;">
                                    <div class="form-group">
                                        <label class="font400">标题：</label>
                                        <select name="custom_cell2[name]" {if condition="$card['is_cell2'] neq '1'"}disabled{/if} class="form-control" id="self-1" onchange="selectchange(this.id)">
                                        {if condition="$card['custom_cell2']['name'] neq ''"}<option value="" selected>{$card['custom_cell2']['name']}</option>{/if}
                                        <option value="">--请选择--</option>
                                        {volist name="urllist" id="dict1"}
                                        <option value="{$dict1.name}" data-title="{$dict1.sub_name}" data-url="{$url['platurl']}{$dict1.url}" {if condition="$card['custom_cell2']['name'] eq $dict1.name"}selected{/if}>{$dict1.name}</option>
                                        {/volist}
                                        </select>
                                        <div class="r-desc ng-binding ng-scope">字段长度限制为5，请填写1-5个汉字</div>
                                        <input type="hidden" value="{$card['custom_cell2']['name']}" class="form-control" placeholder="请输入标题" id="cell2" style="margin-top: 10px;" name="custom_cell2[name]"  oninput="showinput(this.id,this);" onchange="tex('cell2','cell2text','5');">
                                        <div class="help-block" id="cell2text"></div>
                                    </div>
                                    <div class="form-group">
                                        <label class="font400">副标题：</label>
                                        <input type="text" name="custom_cell2[tips]"  value="{$card['custom_cell2']['tips']}" class="form-control self-1-fbt" id="tit2" placeholder="请输入副标题" oninput="showtitl(this.id,this);" onchange="text('tit2','tit2text','12');">
                                        <div class="help-block" id="tit2text"></div>
                                        <div class="r-desc ng-binding ng-scope">字段长度限制为12个字符，中文2个字符，数字，字母1个字符。</div>

                                    </div>

                                    <div class="form-group">
                                        <label class="font400">链接：</label>
                                        <input type="text" name="custom_cell2[url]"  value="{$card['custom_cell2']['url']}"  class="form-control self-1-url"  placeholder="">
                                    </div>
                                </div>
                            </div>
                            <div class="panel panel-default" id="marketing">
                                <div class="panel-heading">自定义栏位2
                                    <div class="pull-right">
                                        <input type="hidden" name="is_cell3" id="self-ipt-2" value="{$card['is_cell3']}">
                                        <a class="btn-link ng-scope" href="javascript:;" data-type="2"
                                           data-name="自定义入口1">{if condition="$card['is_cell3'] eq '1'"}已开启{else}已关闭{/if}</a>
                                    </div>
                                </div>
                                <div class="panel-body" style="padding:30px;">
                                    <input type="hidden" name="custom_cell3[operate_type]" class="self-0-code" value="openWeb">
                                    <div class="form-group">
                                        <label class="font400">标题：</label>
                                        <select name="custom_cell3[name]" {if condition="$card['is_cell3'] neq '1'"}disabled{/if} class="form-control" id="self-2" onchange="selectchange(this.id)">
                                        {if condition="$card['custom_cell3']['name'] neq ''"}<option value="" selected> {$card['custom_cell3']['name']}</option>{/if}
                                        <option value="">--请选择--</option>
                                        {volist name="urllist" id="dict2"}
                                        <option value="{$dict2.name}" data-title="{$dict2.sub_name}" data-url="{$url['platurl']}{$dict2.url}" {if condition="$card['custom_cell3']['name'] eq $dict2.name"}selected{/if}>{$dict2.name}</option>
                                        {/volist}
                                        </select>
                                        <div class="r-desc ng-binding ng-scope">字段长度限制为5，请填写1-5个汉字</div>

                                        <input type="hidden" value="{$card['custom_cell3']['name']}" class="form-control" placeholder="请输入标题" id="cell3" style="margin-top: 10px;" name="custom_cell3[name]"  oninput="showinput(this.id,this);" onchange="tex('cell3','cell3text','5');">
                                        <div class="help-block" id="cell3text"></div>

                                    </div>
                                    <div class="form-group">
                                        <label class="font400">副标题：</label>
                                        <input type="text" name="custom_cell3[tips]"  value="{$card['custom_cell3']['tips']}" class="form-control self-2-fbt" id="tit3" placeholder="请输入副标题" oninput="showtitl(this.id,this);"  onchange="text('tit3','tit3text','12');">
                                        <div class="help-block" id="tit3text"></div>

                                        <div class="r-desc ng-binding ng-scope">字段长度限制为12个字符，中文2个字符，数字，字母1个字符。</div>
                                    </div>
                                    <div class="form-group">
                                        <label class="font400">链接：</label>
                                        <input type="text" name="custom_cell3[url]"  value="{$card['custom_cell3']['url']}"  class="form-control self-2-url" placeholder="">
                                    </div>

                                </div>

                            </div>
                            <div class="panel panel-default" id="recommend">
                                <div class="panel-heading">自定义栏位3
                                    <div class="pull-right">
                                        <input type="hidden" name="is_cell4" id="self-ipt-3" value="{$card['is_cell4']}">
                                        <a class="btn-link ng-scope" href="javascript:;" data-type="3"
                                           data-name="自定义入口1">{if condition="$card['is_cell4'] eq '1'"}已开启{else}已关闭{/if}</a>
                                    </div>
                                </div>
                                <div class="panel-body" style="padding:30px;">
                                    <input type="hidden" name="custom_cell4[operate_type]" class="self-0-code" value="openWeb">
                                    <div class="form-group">
                                        <label class="font400">标题：</label>
                                        <select name="custom_cell4[name]" {if condition="$card['is_cell4'] neq '1'"}disabled{/if} class="form-control" id="self-3" onchange="selectchange(this.id)">
                                        {if condition="$card['custom_cell4']['name'] neq ''"}<option value="" selected> {$card['custom_cell4']['name']}</option>{/if}
                                        <option value="">--请选择--</option>
                                        {volist name="urllist" id="dict3"}
                                        <option value="{$dict3.name}" data-title="{$dict3.sub_name}" data-url="{$url['platurl']}{$dict3.url}" {if condition="$card['custom_cell4']['name'] eq $dict3.name"}selected{/if}>{$dict3.name}</option>
                                        {/volist}
                                        </select>
                                        <div class="r-desc ng-binding ng-scope">字段长度限制为5，请填写1-5个汉字</div>

                                        <input type="hidden" value="{$card['custom_cell4']['name']}" class="form-control" placeholder="请输入标题" id="cell4" style="margin-top: 10px;" name="custom_cell4[name]"  oninput="showinput(this.id,this);" onchange="tex('cell4','cell4text','5');" >
                                        <div class="help-block" id="cell4text"></div>

                                    </div>
                                    <div class="form-group">
                                        <label class="font400">副标题：</label>
                                        <input type="text" name="custom_cell4[tips]"  value="{$card['custom_cell4']['tips']}" class="form-control self-3-fbt" id="tit4" placeholder="请输入副标题" oninput="showtitl(this.id,this);" onchange="text('tit4','tit4text','12');">
                                        <div class="r-desc ng-binding ng-scope">字段长度限制为12个字符，中文2个字符，数字，字母1个字符。</div>
                                    </div>
                                    <div class="form-group">
                                        <label class="font400">链接：</label>
                                        <input type="text" name="custom_cell4[url]"  value="{$card['custom_cell4']['url']}"  class="form-control self-3-url"  placeholder="">
                                    </div>

                                </div>

                            </div>
                        </div>
                    </div>
                    <div role="tabpanel" class="tab-pane" id="carddetail">
                        <div class="panel-body">
                            <div class="panel panel-default" id="applyMall">
                                <div class="panel-heading">适用门店</div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">适用门店：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                    <div class="col-sm-10">
                                        <div>
                                                        <span class="radio" style="margin-right: 15px;">
                                                            <input name="base[is_locations]" value="1" type="radio" {if condition="$card['is_locations'] eq '1'"} checked{/if} style="margin-left: 0;">
                                                            <label class="ng-binding">全部门店（只有选择全部门店，APP会员卡才会显示<span style="color: #00aff0;">适用门店</span>项）</label>
                                                        </span>
                                        </div>
                                        <div>
                                                        <span class="radio" style="margin-right: 15px;">
                                                            <input name="base[is_locations]" value="2" {if condition="$card['is_locations'] eq '2'"} checked{/if}  type="radio" style="margin-left: 0;">
                                                            <label class="ng-binding">指定门店</label>
                                                            <div style="padding-left: 20px;"  {if condition="$card['is_locations'] neq '2'"} class="hide"{/if} id="zdmd">
                                                                <input type="hidden" name="base[location_id_list]" id="location_id_list">
                                                                <a href="javascript:;" data-toggle="modal" data-target="#myModal" style="color: #459AE9;font-size: 14px;">添加适用门店</a>
                                        </div>
                                        </span>
                                    </div>
                                    <div>
                                                        <span class="radio" style="margin-right: 15px;">
                                                            <input name="base[is_locations]" value="3" {if condition="$card['is_locations'] eq '3'"} checked{/if}  type="radio" style="margin-left: 0;">
                                                            <label class="ng-binding">无指定门店</label>
                                                            <!--<div style="padding-left: 20px;overflow: hidden;"  id="wzdmd">-->
                                                            <!--<span class="radio pull-left" style="margin-right: 15px;">-->
                                                            <!--<input name="wzdtype" value="1" type="radio" style="margin-left: 0;">-->
                                                            <!--<label class="ng-binding">网上经营，无须到店消费</label>-->
                                                            <!--</span>-->
                                                            <!--<span class="radio pull-left" style="margin-right: 15px;">-->
                                                            <!--<input name="wzdtype" value="2" type="radio"  style="margin-left: 0;">-->
                                                            <!--<label class="ng-binding">其他原因</label>-->
                                                            <!--</span>-->
                                                            <!--</div>-->
                                                        </span>
                                        <!--<div class="qtyy hide" style="margin-top: 8px;">-->
                                        <!--<textarea name="qtyy"  id="qtyy" class="form-control" cols="30" rows="10" style="resize: none;" placeholder="请认真填写原因"></textarea>-->
                                        <!--</div>-->
                                    </div>
                                </div>
                            </div>
                        </div>

                        <div class="panel panel-default" id="memberDetail">
                            <div class="panel-heading">会员卡详情</div>
                            <div class="panel-body">
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">特权说明：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                    <div class="col-sm-10">
                                        <textarea name="prerogative" rows="4" cols="" id="prerogative" class="form-control" style="resize: none;" >{$card.prerogative}</textarea>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">使用说明：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                    <div class="col-sm-10">
                                        <textarea name="base[description]" rows="4" id="description" cols="" class="form-control" style="resize: none;" >{$card['base_info']['description']}</textarea>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">电话：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                    <div class="col-sm-10">
                                        <input type="text" class="form-control" name="base[service_phone]" id="service_phone" value="{$card['base_info']['service_phone']}" />
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label class="col-sm-2 control-label">使用提醒：<span class="glyphicon glyphicon-asterisk glyphicon-tip"></span></label>
                                    <div class="col-sm-10">
                                        <textarea name="base[notice]" rows="4" cols="" class="form-control" id="notice" style="resize: none;" >{$card['base_info']['notice']}</textarea>
                                        <div class="r-desc ng-binding ng-scope">建议引导用户到店出示会员卡，由店员完成核销操作</div>
                                    </div>
                                </div>
                                <!--<div class="form-group">-->
                                <!--<label class="col-sm-2 control-label">图文介绍(选填)：</label>-->
                                <!--<div class="col-sm-10">-->
                                <!--<div class="r-desc ng-scope">图片建议尺寸：900像素 * 500像素，大小不超过2M。<br>至少上传1组图文，最多输入5000字-->
                                <!--</div>-->
                                <!--<div class="member-card text-image-list ">-->
                                <!--<div class="text-image-list-add">-->
                                <!--<span class="icon_article_add">-->
                                <!--<a class="icon42_common add_gray">添加图文</a>-->
                                <!--</span>-->
                                <!--</div>-->
                                <!--</div>-->
                                <!--</div>-->
                                <!--</div>-->
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="panel-footer">
                <button type="button"  id="creatcards-btn" class="btn btn-success">保存</button>
            </div>
            </form>

        </div>
    </div>
    </div>
    </div>

    {include file='public/footer'/}
    <!--获取门店列表-->
    <!-- Modal -->
    <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
        <div class="modal-dialog" role="document" style="width: 800px;">
            <div class="modal-content">
                <div class="modal-header" style="background: #F4F5F9;">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                    <h4 class="modal-title" id="myModalLabel">选择门店</h4>
                </div>
                <div class="modal-body">
                    <div class="panel panel-default panel-modal" style="border: 0;">
                        <div class="panel-heading"
                             style="overflow: hidden;background: #F4F5F9;border: 1px solid #ddd;border-bottom: 0;">
                            <div class="checkbox pull-left">
                                <label>
                                    <!--<input type="checkbox" id="allchoice"> 门店名称-->
                                    门店名称
                                </label>
                            </div>
                            <div class="checkbox pull-right" style="margin-top: 10px;">
                                <label>地址</label>
                            </div>
                        </div>
                        <div class="panel-body" style="padding: 0;">

                            <table class="table table-bordered">
                                <tbody id="tbody"></tbody>
                            </table>
                        </div>
                    </div>
                </div>
                <div class="modal-footer"
                     style="text-align: center;overflow: hidden;background: #F4F5F9;border: 1px solid #ddd;border-top: 0;">
                    <button type="button" class="btn btn-success" id="choiceComplate">完成</button>
                </div>
            </div>
        </div>
    </div>
    </div>
</section>
</body>
<script src="__STATIC_URL__/static/js/bootstrapSwitch.js"></script>
<script>
    $(function(){

        var card_upload=$("#card-upload").val();
        if(card_upload==""){
            $("#colors").removeClass("hide");
        }else{
            $("#urls").removeClass("hide");
        }
    })


</script>
<script>
    function addform() {
        $('#addcards').submit();
    };
    $(function () {
//        监听模态框显示调取门店数据
        $('#myModal').on('show.bs.modal', function () {
            $.ajax({
                url: "{:url('mach/getstorelist')}",
                type: "post",
                success: function (data) {
                    if(data.code==0){
                        var datas = data.list.data;
                        if (datas == "") {
                            $("#tbody").html("<tr><td>暂无门店</td></tr>");
                        } else {
                            var trlist = "";
                            for (var i = 0; i < datas.length; i++) {
                                trlist += "<tr>" +
                                    "<td><div class='checkbox pull-left'><label><input type='checkbox' name='mallcheck' data-id='" + datas[i].mapid + "'>" + datas[i].business_name + "</label></div></td>" +
                                    "<td><div class='checkbox pull-left'><label>" + datas[i].address + "</label></div></td>" +
                                    "</tr>"
                            }
                            $("#tbody").html(trlist);
                        }
                    }else if(data.code==9001){
                        $("#tbody").html("<tr><td>查询失败</td></tr>");
                    }else if(data.code==9002){
                        $("#tbody").html("<tr><td>暂无门店</td></tr>");
                    }

                }
            })
        });
//        选择适用门店模态框数据清空
        $('#myModal').on('hide.bs.modal', function () {
            $("#tbody").html("");
        });
//        选择适用门店完成
        $('#choiceComplate').click(function () {
            var len = $("input[name='mallcheck']").length;
            var checkid = "";
            for (var i = 0; i < len; i++) {
                if ($("input[name='mallcheck']").eq(i).is(':checked')) {
                    var id = $("input[name='mallcheck']").eq(i).attr("data-id");
                    if (checkid == "") {
                        checkid = id;
                    } else {
                        checkid += "," + id;
                    }
                }
            }
            if (checkid == "") {
                layer.alert("请选择门店")
            } else {
                $("#location_id_list").val(checkid);
                $('#myModal').modal("hide");
            }
        });
//        全选
        $("#allchoice").click(function(){
            var t = $(this).is(":checked");
            if(t == true){
                $("input[name='mallcheck']").attr("checked",true);
            }else if(t==false){
                $("input[name='mallcheck']").removeAttr("checked");
            }
        });
        $('#end_time').datetimepicker({
            minView: "month", //选择日期后，不会再跳转去选择时分秒
            language: 'zh-CN',
            format: 'yyyy-mm-dd',
            todayBtn: 1,
            autoclose: 1,
            todayHighlight: true,
        });
    });

</script>
<script type="text/javascript">
    function upload(file, typed) {
        var formData = new FormData();
        formData.append('file', $('#' + file)[0].files[0]);
        formData.append('other', file);
        var _name = $('#' + file)[0].value;
        var _fileName = _name.slice(_name.lastIndexOf(".")+1).toLowerCase();


        if (_fileName !== "png" && _fileName !== "jpg"&& _fileName !== "jpeg") {
            alert("上传图片格式不正确，请重新上传");
            $('#' + file).val('')
            $("." + file).css("backgroundImage", "url()");
//            右侧预览图片
            $("." + file + "-img").attr("src", '');
//            相应隐藏input传值
            $("#" + file + "-upload").val('');

            return false;
        }
        $.ajax({
            url: "{:url('uploads/upload')}",
            type: 'POST',
            cache: false,
            data: formData,
            processData: false,
            contentType: false,
        }).done(function (res) {
            if(res.code=="0"){
//            左侧预览图背景
                $("." + file).css("backgroundImage", "url(" + res.pic + ")");
//            右侧预览图片
                $("." + file + "-img").attr("src", res.pic);
//            相应隐藏input传值
                $("#" + file + "-pic").val(res.loc_pic);
                $("#" + file + "-upload").val(res.pic);
            }else{
                layer.alert(res.message);
            }
            // $("." + file).attr("src", res.savapath).css("display", "block");
            // $(".file-" + file).val(res.other);
            // $("." + typed + "-" + file).val(res.other);
        }).fail(function (res) {
            alert("上传失败")
        });
    };
    $(function () {
//        选取优惠券背景颜色
        $(".color-list li").click(function () {
            $(".color-list li").removeClass("selected");
            $(this).addClass("selected");
            var colors = $(this).attr("data-color");
            $(".card_section").css("background-color", colors);
            $(".ljsy").css("background-color", colors);
            $("input[name='base[color]']").val(colors);
        });
    })
</script>
<script>
    var GetLength = function (str) {
        ///<summary>获得字符串实际长度，中文2，英文1</summary>
        ///<param name="str">要获得长度的字符串</param>
        var realLength = 0, len = str.length, charCode = -1;
        for (var i = 0; i < len; i++) {
            charCode = str.charCodeAt(i);
            if (charCode >= 0 && charCode <= 128) realLength += 1;
            else realLength += 2;
        }
        //console.log(realLength);
        return realLength;
    };

    //js截取字符串，中英文都能用
    //如果给定的字符串大于指定长度，截取指定长度返回，否者返回源字符串。
    //字符串，长度

    /**
     * js截取字符串，中英文都能用
     * @param str：需要截取的字符串
     * @param len: 需要截取的长度
     */
    function cutstr(str, len) {
        var str_length = 0;
        var str_len = 0;
        str_cut = new String();
        str_len = str.length;
        for (var i = 0; i < str_len; i++) {
            a = str.charAt(i);
            str_length++;
            if (escape(a).length > 4) {
                //中文字符的长度经编码之后大于4
                str_length++;
            }
            str_cut = str_cut.concat(a);
            //console.log(str_cut);
            if (str_length >= len) {
                //str_cut = str_cut.concat("...");
                return str_cut;
                // console.log(str_cut);
                //console.log(len);
            }
        }
        //如果给定字符串小于指定长度，则返回源字符串；
        if (str_length < len) {
            return str;
        }
    }
    function text(idq,tex,num){

        if (GetLength($("#"+idq).val()) > num) {

            $("#"+idq).val(cutstr($("#"+idq).val(), num));

        }
        var val=$("#"+idq).val();
        $("."+idq).html(val)
        $("."+idq).val(val)

    };
</script>
<script>

    /**验证字数*/
    function tex(idq,tex,num){
        // console.log(idq,tex,num)
        $("#"+tex).text("还可以输入" + (num - $("#"+idq).val().length) + "个字");


        if ( $("#"+idq).val().length > num) {
            $("#"+idq).val( $("#"+idq).val().substring(0, num));
        }
        $("#"+tex).text("还可以输入" + (num -  $("#"+idq).val().length) + "个字");
        var val=$("#"+idq).val();
        $("."+idq).html(val)
        $("."+idq).val(val)
//console.log($("#"+idq).val());
    }


</script>
<script>
    $("#self-type-ch").change(function(){
        // console.log($(this).val());
        var sval=$(this).val();
        if(sval=="自定义"){

            $(this).siblings("input").prop("type","text");
        }else{
            $(this).siblings("input").prop("type","hidden");
        }

    })
</script>
<script>
    function showinput(id,obj){
        var val=$(obj).val();

        $("."+id+"-bt").text(val);

    }
    function showtitl(id,obj){
        var val=$(obj).val();
        $("."+id+"-bt").text(val);
        $("."+id+"-bt").val(val);
    }
    function showhui(obj){
        var val=$(obj).val();

        $(".hui").text(val);

    }
    function showvice(obj){
        var val=$(obj).val();
        $(".vice").text(val);
    }
</script>
</html>
